import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/profile',
    },
    {
      path: '/profile',
      component: () => import('../views/ProfileEdit.vue'),
      meta: { title: '个人资料' },
    },
    {
      path: '/editName',
      component: () => import('../views/EditName.vue'),
      meta: { title: '编辑昵称' },
    },
    {
      path: '/editInfro',
      component: () => import('../views/EditInfro.vue'),
      meta: { title: '编辑简介' },
    },
  ],
})

router.afterEach((to) => {
  document.title = to.meta.title as string
})

export default router
